<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.0.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/img/favicon.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/img/favicon.ico">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    hostname: new URL('https://cxyzjp.gitee.io').hostname,
    root: '/',
    scheme: 'Pisces',
    version: '7.6.0',
    exturl: true,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":true},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":true},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: true,
    lazyload: true,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":1,"preload":true},
    path: 'search.json',
    motion: {"enable":false}
  };
</script>

  <meta name="description" content="环境基于windows 安装 Githttps:&#x2F;&#x2F;git-scm.com&#x2F;downloads 安装 Node.jshttps:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F;download&#x2F;配置镜像地址: $ npm config set registry http:&#x2F;&#x2F;registry.npm.taobao.org&#x2F;">
<meta name="keywords" content="hexo">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo搭建博客">
<meta property="og:url" content="https:&#x2F;&#x2F;cxyzjp.gitee.io&#x2F;hexo&#x2F;build-blog&#x2F;index.html">
<meta property="og:site_name" content="程序员的日常">
<meta property="og:description" content="环境基于windows 安装 Githttps:&#x2F;&#x2F;git-scm.com&#x2F;downloads 安装 Node.jshttps:&#x2F;&#x2F;nodejs.org&#x2F;en&#x2F;download&#x2F;配置镜像地址: $ npm config set registry http:&#x2F;&#x2F;registry.npm.taobao.org&#x2F;">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-12-13T06:22:40.000Z">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://cxyzjp.gitee.io/hexo/build-blog/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>Hexo搭建博客 | 程序员的日常</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">程序员的日常</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <h1 class="site-subtitle" itemprop="description">自强不息</h1>
      
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档<span class="badge">5</span></a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签<span class="badge">6</span></a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="none"
           placeholder="搜索..." spellcheck="false"
           type="text" id="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://cxyzjp.gitee.io/hexo/build-blog/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/img/avatar.jpg">
      <meta itemprop="name" content="CXYZJP">
      <meta itemprop="description" content="记录生活中的点点滴滴">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="程序员的日常">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          Hexo搭建博客
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2019-12-01 18:29:14" itemprop="dateCreated datePublished" datetime="2019-12-01T18:29:14+08:00">2019-12-01</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2019-12-13 14:22:40" itemprop="dateModified" datetime="2019-12-13T14:22:40+08:00">2019-12-13</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="环境"><a href="#环境" class="headerlink" title="环境"></a>环境</h1><p>基于windows</p>
<h2 id="安装-Git"><a href="#安装-Git" class="headerlink" title="安装 Git"></a>安装 Git</h2><p><span class="exturl" data-url="aHR0cHM6Ly9naXQtc2NtLmNvbS9kb3dubG9hZHM=" title="https://git-scm.com/downloads">https://git-scm.com/downloads<i class="fa fa-external-link"></i></span></p>
<h2 id="安装-Node-js"><a href="#安装-Node-js" class="headerlink" title="安装 Node.js"></a>安装 Node.js</h2><p><span class="exturl" data-url="aHR0cHM6Ly9ub2RlanMub3JnL2VuL2Rvd25sb2FkLw==" title="https://nodejs.org/en/download/">https://nodejs.org/en/download/<i class="fa fa-external-link"></i></span><br>配置镜像地址: <code>$ npm config set registry http://registry.npm.taobao.org/</code></p>
<a id="more"></a>

<h1 id="Hexo"><a href="#Hexo" class="headerlink" title="Hexo"></a>Hexo</h1><h2 id="安装-Hexo"><a href="#安装-Hexo" class="headerlink" title="安装 Hexo"></a>安装 Hexo</h2><p>官网：<span class="exturl" data-url="aHR0cHM6Ly9oZXhvLmlvL3poLWNuLw==" title="https://hexo.io/zh-cn/">https://hexo.io/zh-cn/<i class="fa fa-external-link"></i></span><br>安装：<code>$ npm install -g hexo-cli</code><br>发布工具： <code>$ npm install hexo-deployer-git --save</code></p>
<h2 id="建站"><a href="#建站" class="headerlink" title="建站"></a>建站</h2><p>在指定文件夹如：D:\workspace\workspace_hexo下运行：</p>
<ol>
<li><code>$ hexo init</code></li>
<li><code>$ npm install</code></li>
</ol>
<h2 id="配置主题"><a href="#配置主题" class="headerlink" title="配置主题"></a>配置主题</h2><ol>
<li>拷贝主题文件夹到hexo根目录的themes文件夹中</li>
<li>配置根目录下<strong>_config.yml</strong>文件的<strong>theme</strong>值为主题名称</li>
<li>修改主题文件夹下的<strong>_config.yml</strong>可对主题定制化</li>
</ol>
<p>hexo主题：<span class="exturl" data-url="aHR0cHM6Ly9oZXhvLmlvL3RoZW1lcy8=" title="https://hexo.io/themes/">https://hexo.io/themes/<i class="fa fa-external-link"></i></span></p>
<ul>
<li><span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2l0bXVjaC9oZXhvLXRoZW1lLWl0bXVjaA==" title="https://github.com/itmuch/hexo-theme-itmuch">https://github.com/itmuch/hexo-theme-itmuch<i class="fa fa-external-link"></i></span></li>
<li><span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2FpcmNsb3VkL2hleG8tdGhlbWUtYWlyY2xvdWQ=" title="https://github.com/aircloud/hexo-theme-aircloud">https://github.com/aircloud/hexo-theme-aircloud<i class="fa fa-external-link"></i></span></li>
<li><span class="exturl" data-url="aHR0cHM6Ly90aGVtZS1uZXh0Lm9yZy8=" title="https://theme-next.org/">https://theme-next.org/<i class="fa fa-external-link"></i></span></li>
</ul>
<h2 id="创建文件"><a href="#创建文件" class="headerlink" title="创建文件"></a>创建文件</h2><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">&#x2F;&#x2F; 默认</span></pre></td></tr><tr><td class="code"><pre><span class="line">$ hexo new &quot;Title&quot;</span></pre></td></tr><tr><td class="code"><pre><span class="line">&#x2F;&#x2F; 创建包含路径的文件</span></pre></td></tr><tr><td class="code"><pre><span class="line">$ hexo new --path path&#x2F;filename &quot;Title&quot;</span></pre></td></tr></table></figure>

<h2 id="运行本地服务"><a href="#运行本地服务" class="headerlink" title="运行本地服务"></a>运行本地服务</h2><ol>
<li><code>$ hexo s</code></li>
<li>访问：<span class="exturl" data-url="aHR0cDovL2xvY2FsaG9zdDo0MDAw" title="http://localhost:4000">http://localhost:4000<i class="fa fa-external-link"></i></span></li>
</ol>
<h2 id="发布"><a href="#发布" class="headerlink" title="发布"></a>发布</h2><ol>
<li>在_config.yml中配置Git<figure class="highlight yml"><table><tr><td class="code"><pre><span class="line"><span class="attr">url:</span> <span class="string">https://cxyzjp.gitee.io/</span></span></pre></td></tr><tr><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span></pre></td></tr><tr><td class="code"><pre><span class="line">   <span class="attr">type:</span> <span class="string">git</span></span></pre></td></tr><tr><td class="code"><pre><span class="line">   <span class="attr">repository:</span> <span class="string">https://gitee.com/cxyzjp/cxyzjp.git</span></span></pre></td></tr><tr><td class="code"><pre><span class="line">   <span class="attr">branch:</span> <span class="string">master</span></span></pre></td></tr></table></figure></li>
<li>执行：<code>$ hexo g -d</code></li>
</ol>
<h1 id="Gitee配置"><a href="#Gitee配置" class="headerlink" title="Gitee配置"></a>Gitee配置</h1><ol>
<li>新建项目<strong>cxyzjp</strong>(与仓库名相同，好处是二级域名直接访问到Pages)。</li>
<li>自定义域名（VIP功能）。云平台-域名解析-添加CNAME（记录值为gitee.gitee.io）；Gitee自定义域名-填写解析的域名。</li>
<li>Gitee Pages中点更新。</li>
</ol>
<h1 id="踩坑"><a href="#踩坑" class="headerlink" title="踩坑"></a>踩坑</h1><h2 id="windows-powershell-此系统上禁止运行脚本"><a href="#windows-powershell-此系统上禁止运行脚本" class="headerlink" title="windows powershell 此系统上禁止运行脚本"></a>windows powershell 此系统上禁止运行脚本</h2><p>以管理员方式运行，命令提示符下执行：<br><code>$ set-ExecutionPolicy RemoteSigned</code></p>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/hexo/" rel="tag"># hexo</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item"></div>
      <div class="post-nav-item">
    <a href="/algorithm/file-check/" rel="next" title="文件校验">
      文件校验 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#环境"><span class="nav-number">1.</span> <span class="nav-text">环境</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装-Git"><span class="nav-number">1.1.</span> <span class="nav-text">安装 Git</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装-Node-js"><span class="nav-number">1.2.</span> <span class="nav-text">安装 Node.js</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Hexo"><span class="nav-number">2.</span> <span class="nav-text">Hexo</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装-Hexo"><span class="nav-number">2.1.</span> <span class="nav-text">安装 Hexo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#建站"><span class="nav-number">2.2.</span> <span class="nav-text">建站</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置主题"><span class="nav-number">2.3.</span> <span class="nav-text">配置主题</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#创建文件"><span class="nav-number">2.4.</span> <span class="nav-text">创建文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#运行本地服务"><span class="nav-number">2.5.</span> <span class="nav-text">运行本地服务</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#发布"><span class="nav-number">2.6.</span> <span class="nav-text">发布</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Gitee配置"><span class="nav-number">3.</span> <span class="nav-text">Gitee配置</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#踩坑"><span class="nav-number">4.</span> <span class="nav-text">踩坑</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#windows-powershell-此系统上禁止运行脚本"><span class="nav-number">4.1.</span> <span class="nav-text">windows powershell 此系统上禁止运行脚本</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="CXYZJP"
      src="/img/avatar.jpg">
  <p class="site-author-name" itemprop="name">CXYZJP</p>
  <div class="site-description" itemprop="description">记录生活中的点点滴滴</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">5</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2N4eXpqcA==" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;cxyzjp"><i class="fa fa-fw fa-github"></i></span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="bWFpbHRvOjMyODEwODIyM0BxcS5jb20=" title="E-Mail → mailto:328108223@qq.com"><i class="fa fa-fw fa-envelope"></i></span>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cDovL2N4eXpqcC5jbg==" title="http:&#x2F;&#x2F;cxyzjp.cn">个人主页</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9naXRlZS5jb20vY3h5empwL2N4eXpqcC9wYWdlcw==" title="https:&#x2F;&#x2F;gitee.com&#x2F;cxyzjp&#x2F;cxyzjp&#x2F;pages">Gitee Pages</span>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 2018 – 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">CXYZJP</span>
</div>
  <div class="powered-by">由 <span class="exturl theme-link" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> 强力驱动
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <span class="exturl theme-link" data-url="aHR0cHM6Ly9waXNjZXMudGhlbWUtbmV4dC5vcmc=">NexT.Pisces</span>
  </div>

        








        
      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/medium-zoom@1/dist/medium-zoom.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/lozad@1/dist/lozad.min.js"></script>
<script src="/js/utils.js"></script>
<script src="/js/schemes/pisces.js"></script>
<script src="/js/next-boot.js"></script>



  




  <script src="/js/local-search.js"></script>













  

  

  

</body>
</html>
